/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EL;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 *
 * @author Tian
 */
@Entity
@Table(name = "Reservation")
@NamedQueries(
{
    @NamedQuery(name = "Reservations.findAll", query = "SELECT r FROM Reservations r")
})
public class Reservations implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private String id;
    @Column(name = "reserDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date reserDate;
    @Column(name = "total")
    private Float total;
    @Column(name = "isProcessed")
    private Boolean isProcessed;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "reservations")
    @LazyCollection(LazyCollectionOption.FALSE)
    private List<ReservationDetails> reservationDetailsList;
    @JoinColumn(name = "accID", referencedColumnName = "id")
    @ManyToOne
    private Accounts accounts;

    public Reservations()
    {
    }

    public Reservations(String id, Date reserDate, Float total, Boolean isProcessed)
    {
        this.id = id;
        this.reserDate = reserDate;
        this.total = total;
        this.isProcessed = isProcessed;
    }

    



    public Float getTotal()
    {
        return total;
    }

    public void setTotal(Float total)
    {
        this.total = total;
    }

   
    
    public Reservations(String id)
    {
        this.id = id;
    }

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public Date getReserDate()
    {
        return reserDate;
    }

    public void setReserDate(Date reserDate)
    {
        this.reserDate = reserDate;
    }

    public Boolean getIsProcessed()
    {
        return isProcessed;
    }

    public void setIsProcessed(Boolean isProcessed)
    {
        this.isProcessed = isProcessed;
    }

    public List<ReservationDetails> getReservationDetailsList()
    {
        return reservationDetailsList;
    }

    public void setReservationDetailsList(List<ReservationDetails> reservationDetailsList)
    {
        this.reservationDetailsList = reservationDetailsList;
    }

    public Accounts getAccounts()
    {
        return accounts;
    }

    public void setAccounts(Accounts accounts)
    {
        this.accounts = accounts;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Reservations))
        {
            return false;
        }
        Reservations other = (Reservations) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "EL.Reservations[id=" + id + "]";
    }

}
